package com.xkdx.guangguang.fragment.shop.uploadphoto;

import org.json.JSONArray;
import org.json.JSONObject;

import com.xkdx.guangguang.module.network.AbsModule;

public class BrandUploadPhotoModule extends AbsModule {
	public boolean isUploadSuccess = false;
	public String message;

	@Override
	public void parseData() throws Exception {
		backJson = (JSONArray) result;
		try {
			for (int i = 0; i < backJson.length(); i++) {
				jsonObj = (JSONObject) backJson.get(i);
				String sortOfAct = jsonObj.getString("Act");
				if (sortOfAct.equals("uploadPhotoToBrand")) {
					isUploadSuccess = parseShopPhotoUpLoad(jsonObj.getJSONObject("Content"));
				}

			}
		} catch (Exception e) {
			// TODO: handle exception
		}
	}

	private boolean parseShopPhotoUpLoad(JSONObject person) throws Exception {
		try {
			if (person == null) {
				return false;
			}
			JSONObject stut = (JSONObject) person.get("Result");
			String result = stut.getString("Status");
			message = stut.getString("Message");

			if (result != null && result.equals("Success")) {
				return true;
			}

		} catch (Exception e) {
			throw e;
		}
		return false;

	}

}
